Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

235
Visualizações
What the "rotation" in expo-sensors' DeviceMotion returns exactly?

I'm building an App where I need to rely on compass azimuth/bearing/heading whatever you call it: the angle between the North and the Y-axis of the phone.

I read the greater half of the Internet and learned about "Sensor fusion" and it's virtual form of ROTATION_VECTOR in Android. I got familiarized with SensorManager and DeviceMotionModule.

Boiling it down to expo-sensors' DeviceMotion, my test code looks like so:

import { DeviceMotion } from 'expo-sensors'

DeviceMotion.addListener( ({ rotation }) => 
  console.info( ( 360 + this.toDegreesInt( rotation.alpha ) ) % 360 ) 
)

Now if I rotate the device, the value changes somehow, but if I point it to the North, I get an angle of 124 degrees which is far beyond the uncalibrated compass reading.

Also, if I rotate the device 360 degrees, the supposed azimuth value never goes from 0 to 359, but rather in some randomly spread chunks.

Google Navigation on the very same device works like charm...

How can I make my compass work?

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda